﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'proc_cm_GetActiveQuickAnnouncement')
BEGIN
    PRINT 'Dropping Procedure proc_cm_GetActiveQuickAnnouncement'
    DROP  Procedure  proc_cm_GetActiveQuickAnnouncement
END
GO

PRINT 'Creating Procedure proc_cm_GetActiveQuickAnnouncement'
GO

CREATE PROCEDURE [dbo].[proc_cm_GetActiveQuickAnnouncement]
AS
BEGIN
	SET NOCOUNT ON

	SELECT TOP 1
		[quick_announcement_txt] as [Announcement]
	FROM [dbo].[tbl_quick_announcement] (NOLOCK)
	WHERE
		[enabled_ind] = 1
		AND ISNULL([effective_date_from], '1/1/2000') <= GETDATE()
		AND ISNULL([effective_date_to], DATEADD(day, 1, GETDATE())) >= GETDATE()
END
GO

GRANT EXEC ON dbo.proc_cm_GetActiveQuickAnnouncement TO PUBLIC
GO


